from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from flask_wtf import CSRFProtect
import redis
from flask_session import Session


class Config:
    DEBUG = True
    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/information"
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SECRET_KEY = "dfsdfdfdsfdsf"
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379
    SESSION_TYPE = "redis"
    SESSION_USE_SIGNER = True
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    PERMANENT_SESSION_LIFETIME = 86400




app = Flask(__name__)
app.config.from_object(Config)
db = SQLAlchemy(app)
migrate = Migrate(app,db)
manager = Manager(app)
manager.add_command("xxxx", MigrateCommand)
CSRFProtect(app)
redis_storage = redis.StrictRedis(host=Config.REDIS_HOST,port=Config.REDIS_PORT,db=0)
Session(app)


@app.route("/")
def index():
    return "index1111"

if __name__ == '__main__':
    manager.run()

